

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>Custom Container Service &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="Monitoring Services" href="../monitoring/" />
    <link rel="prev" title="iSCSI Service" href="../iscsi/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">Cephadm</a> &raquo;</li>
        
          <li><a href="../">Service Management</a> &raquo;</li>
        
      <li>Custom Container Service</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/cephadm/services/custom-container.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Cephadm</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../compatibility/">Compatibility and Stability</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../install/">部署个全新的 Ceph 集群</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../adoption/">现有集群切换到 cephadm</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../host-management/">Host Management</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">Service Management</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../mon/">MON Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mgr/">MGR Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd/">OSD Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rgw/">RGW Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds/">MDS Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nfs/">NFS Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../iscsi/">iSCSI Service</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Custom Container Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">Monitoring Services</a></li>
<li class="toctree-l3"><a class="reference internal" href="../snmp-gateway/">SNMP Gateway Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#service-status">Service Status</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#daemon-status">Daemon Status</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#service-specification">Service Specification</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#daemon-placement">Daemon Placement</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#removing-a-service">Removing a Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#disabling-automatic-deployment-of-daemons">Disabling automatic deployment of daemons</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../upgrade/">Ceph 的升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../operations/">Cephadm operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../client-setup/">Client Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../dev/cephadm/">Cephadm Feature Planning</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="custom-container-service">
<h1>Custom Container Service<a class="headerlink" href="#custom-container-service" title="Permalink to this headline">¶</a></h1>
<p>The orchestrator enables custom containers to be deployed using a YAML file.
A corresponding <a class="reference internal" href="../#orchestrator-cli-service-spec"><span class="std std-ref">Service Specification</span></a> must look like:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">container</span>
<span class="nt">service_id</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">foo</span>
<span class="nt">placement</span><span class="p">:</span>
    <span class="l l-Scalar l-Scalar-Plain">...</span>
<span class="nt">spec</span><span class="p">:</span>
  <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">docker.io/library/foo:latest</span>
  <span class="nt">entrypoint</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">/usr/bin/foo</span>
  <span class="nt">uid</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">1000</span>
  <span class="nt">gid</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">1000</span>
  <span class="nt">args</span><span class="p">:</span>
    <span class="p p-Indicator">-</span> <span class="s">&quot;--net=host&quot;</span>
    <span class="p p-Indicator">-</span> <span class="s">&quot;--cpus=2&quot;</span>
  <span class="nt">ports</span><span class="p">:</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">8080</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">8443</span>
  <span class="nt">envs</span><span class="p">:</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">SECRET=mypassword</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">PORT=8080</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">PUID=1000</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">PGID=1000</span>
  <span class="nt">volume_mounts</span><span class="p">:</span>
    <span class="nt">CONFIG_DIR</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">/etc/foo</span>
  <span class="nt">bind_mounts</span><span class="p">:</span>
    <span class="p p-Indicator">-</span> <span class="p p-Indicator">[</span><span class="s">&#39;type=bind&#39;</span><span class="p p-Indicator">,</span> <span class="s">&#39;source=lib/modules&#39;</span><span class="p p-Indicator">,</span> <span class="s">&#39;destination=/lib/modules&#39;</span><span class="p p-Indicator">,</span> <span class="s">&#39;ro=true&#39;</span><span class="p p-Indicator">]</span>
  <span class="nt">dirs</span><span class="p">:</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">CONFIG_DIR</span>
  <span class="nt">files</span><span class="p">:</span>
    <span class="nt">CONFIG_DIR/foo.conf</span><span class="p">:</span>
      <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">refresh=true</span>
      <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">username=xyz</span>
      <span class="p p-Indicator">-</span> <span class="s">&quot;port:</span><span class="nv"> </span><span class="s">1234&quot;</span>
</pre></div>
</div>
<p>where the properties of a service specification are:</p>
<ul class="simple">
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">service_id</span></code></dt><dd><p>A unique name of the service.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">image</span></code></dt><dd><p>The name of the Docker image.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">uid</span></code></dt><dd><p>The UID to use when creating directories and files in the host system.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">gid</span></code></dt><dd><p>The GID to use when creating directories and files in the host system.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">entrypoint</span></code></dt><dd><p>Overwrite the default ENTRYPOINT of the image.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">args</span></code></dt><dd><p>A list of additional Podman/Docker command line arguments.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">ports</span></code></dt><dd><p>A list of TCP ports to open in the host firewall.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">envs</span></code></dt><dd><p>A list of environment variables.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">bind_mounts</span></code></dt><dd><p>When you use a bind mount, a file or directory on the host machine
is mounted into the container. Relative <cite>source=…</cite> paths will be
located below <cite>/var/lib/ceph/&lt;cluster-fsid&gt;/&lt;daemon-name&gt;</cite>.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">volume_mounts</span></code></dt><dd><p>When you use a volume mount, a new directory is created within
Docker’s storage directory on the host machine, and Docker manages
that directory’s contents. Relative source paths will be located below
<cite>/var/lib/ceph/&lt;cluster-fsid&gt;/&lt;daemon-name&gt;</cite>.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">dirs</span></code></dt><dd><p>A list of directories that are created below
<cite>/var/lib/ceph/&lt;cluster-fsid&gt;/&lt;daemon-name&gt;</cite>.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">files</span></code></dt><dd><p>A dictionary, where the key is the relative path of the file and the
value the file content. The content must be double quoted when using
a string. Use ‘\n’ for line breaks in that case. Otherwise define
multi-line content as list of strings. The given files will be created
below the directory <cite>/var/lib/ceph/&lt;cluster-fsid&gt;/&lt;daemon-name&gt;</cite>.
The absolute path of the directory where the file will be created must
exist. Use the <cite>dirs</cite> property to create them if necessary.</p>
</dd>
</dl>
</li>
</ul>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../monitoring/" class="btn btn-neutral float-right" title="Monitoring Services" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../iscsi/" class="btn btn-neutral float-left" title="iSCSI Service" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>